package zhao.tx.eecs.zhao;


import com.google.zxing.client.android.CaptureActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import zhao.tx.eecs.R;

public class PD_Shaomiao extends Activity {
	private final String url="http://192.168.12.217:8069/user.ashx";
	public static final int SCAN_CODE = 1;
	private Handler handler=new Handler(){
		@Override
		public void handleMessage(Message msg) {
		}
	};
	//OnClickListener listen1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView( R.layout.pd_saomiao);
		
		InitLayout();
	}
	
	//��̬��Ӳ��ֿؼ�
	public void InitLayout() {
//		LinearLayout mainLayout=(LinearLayout)findViewById(R.id.mainLayout);
//		Button btn1=new Button(this);  
//	    btn1.setText("1����");  
//	    btn1.setTextSize(12);
//	    
//	    btn1.setBackground(getResources().getDrawable(R.color.border));
//	    
//	    btn1.setId(10000);
//	    LinearLayout.LayoutParams lp1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 25);  
//	    lp1.leftMargin=0;  
//	    lp1.topMargin = 2; 
//	    mainLayout.addView(btn1,lp1);  
//	    
//	     listen1 = new OnClickListener() {  
//	        public void onClick(View v) {  
//	            
//	        }  
//	    };  
//	     btn1.setOnClickListener(listen1);
	}
	public void btn_back_click(View v) {			 
		 
		 PD_Shaomiao.this.finish();
	}
	public void btn_OK_click(View v) {			 
		 
		 PD_Shaomiao.this.finish();
	}
	
	public void btn_saomiao_click(View v) {	
		Intent intent = new Intent(PD_Shaomiao.this, CaptureActivity.class);
		startActivityForResult(intent, SCAN_CODE);
	}
	
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		switch (requestCode) {
		case SCAN_CODE:
			TextView scanResult = (TextView) findViewById(R.id.txt02);
			if (resultCode == RESULT_OK) {
				String result = data.getStringExtra("scan_result");
				scanResult.setText(result);
			} else if (resultCode == RESULT_CANCELED) {
				scanResult.setText("1111111111111111");
			}
			break;
		default:
			break;
		}
	}

}
